﻿using System;
using System.Collections.Generic;
using Colorful.Furniture.CommonDto;

namespace Colorful.Furniture.PermissionManagement
{
    /// <summary>
    ///  权限输出体
    /// </summary>
    public class PermissionOutputDto
    {
        /// <summary>
        ///  权限名字（如：StoreUserLabel_View）
        /// </summary>
        public string PermissionName { get; set; }

        /// <summary>
        ///  权限标题(如：会员标签_查看）)
        /// </summary>
        public string PermissionTitle { get; set; }
    }

    /// <summary>
    ///  设置权限请求体
    /// </summary>
    public class SetPermissionInputDto
    {
        /// <summary>
        ///  权限编码
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        ///  资源编码
        /// </summary>
        public Guid ResourceId { get; set; }

        /// <summary>
        ///  父级资源编码
        /// </summary>
        public Guid? ParentResourceId { get; set; }

        /// <summary>
        ///  资源名字
        /// </summary>
        public string ResourceName { get; set; }

        /// <summary>
        ///  操作排序
        /// </summary>
        public int? OperationSort { get; set; }

        /// <summary>
        ///  资源标题
        /// </summary>
        public string ResourceTitle { get; set; }

        /// <summary>
        ///  操作代码
        /// </summary>
        public string OperationName { get; set; }

        /// <summary>
        ///  操作名字
        /// </summary>
        public string OperationTitle { get; set; }
    }

    /// <summary>
    ///  操作请求体
    /// </summary>
    public class OperationInputDto
    {
        /// <summary>
        ///  代码
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///  名字
        /// </summary>
        public string Title { get; set; }
    }

    /// <summary>
    ///  权限对应的接口树形列表
    /// </summary>
    public class PermissionWithApiTreeListOutputDto
    {
        /// <summary>
        ///  已授权的权限接口编码列表
        /// </summary>
        public List<PermissionApiOutputDto> PermissionApiIdList { get; set; }
        
        /// <summary>
        ///  接口列表
        /// </summary>
        public List<TreeOutputDto<string>> ApiList { get; set; }

        /// <summary>
        ///  资源标题
        /// </summary>
        public string ResourceTitle { get; set; }
    }

    /// <summary>
    ///  权限和接口
    /// </summary>
    public class PermissionApiOutputDto
    {
        /// <summary>
        ///  权限编码
        /// </summary>
        public Guid? PermissionId { get; set; }

        /// <summary>
        ///  接口编码
        /// </summary>
        public Guid? ApiId { get; set; }
    }

    /// <summary>
    ///  默认权限输出
    /// </summary>
    public class DefaultPermissionOutputDto
    {
        /// <summary>
        ///  默认权限编码
        /// </summary>
        public Guid? DefaultPermissionId { get; set; }

        /// <summary>
        ///  操作标题
        /// </summary>
        public string OperationTitle { get; set; }
    }

    /// <summary>
    ///  资源拥有的操作权限列表
    /// </summary>
    public class PermissionOperationListOutput
    {
        /// <summary>
        ///  权限编码
        /// </summary>
        public Guid PermissionId { get; set; }

        /// <summary>
        ///  资源编码
        /// </summary>
        public Guid? ResourceId { get; set; }

        /// <summary>
        ///  接口权限赋值数量
        /// </summary>
        public int ApiCount { get; set; }

        /// <summary>
        ///  操作标题
        /// </summary>
        public string OperationTitle { get; set; }
    }

    /// <summary>
    ///  设置权限的接口
    /// </summary>
    public class SetPermissionApiInputDto
    {
        /// <summary>
        ///  权限编码
        /// </summary>
        public Guid PermissionId { get; set; }
        
        /// <summary>
        ///  接口编码集合
        /// </summary>
        public Guid? ApiId { get; set; }
    }
}